///*
// * To change this license header, choose License Headers in Project Properties.
// * To change this template file, choose Tools | Templates
// * and open the template in the editor.
// */
//package cn.iie.ac.testbak0605;
//
//import java.util.ArrayList;
//import java.util.Random;
//
///**
// *
// * @author xiaoliang
// */
//public class Randomtest {
//
////        for (int i = 0; i < 10; i++) {
////            String[] Address = "10.136.65.1;10.136.65.2;10.136.65.3".split("[;]");
////            Random ran = new Random();
////            int num = ran.nextInt(Address.length);
////            String addressOne = Address[num];
////            System.out.println(addressOne);
////        }
////    public static void main(String[] args) {
////        try {
////            List<ResultSetFuture> future = new ArrayList<ResultSetFuture>();
////            String sql = "UPDATE tp_msg_microblog SET ocont=['hello','测试111','world'] WHERE key=:key if exists ";
////            QueryOptions options = new QueryOptions();
////            options.setConsistencyLevel(ConsistencyLevel.LOCAL_ONE);
////            Cluster.Builder builder = Cluster.builder();
////            builder.withSocketOptions(new SocketOptions().setConnectTimeoutMillis(1500).setReadTimeoutMillis(2000))
////                    .withLoadBalancingPolicy(new TokenAwarePolicy(DCAwareRoundRobinPolicy.builder().withLocalDc("data-wb").build()))
////                    .withCredentials("cassandra", "cassandra").addContactPoint("10.136.133.115").withPort(9042).withQueryOptions(options);
////            Cluster cluster = builder.build();
////            Session session = cluster.connect("new_wb");
////            PreparedStatement update_statment = session.prepare(sql);
////            BoundStatement bs = update_statment.bind();
////            bs.bind("tsina_4127577482482279");
////
////            future.add(session.executeAsync(bs));
////            for (int i = 0; i < future.size(); ++i) {
////                future.get(i).get();
////            }
////        } catch (Exception ex) {
////            LOG.error(ex.getMessage());
////        }
////    }
//    public static void main(String[] args) {
//        try {
//            List<ResultSetFuture> future = new ArrayList<ResultSetFuture>();
//            String sql = "UPDATE tp_msg_microblog SET ocont=['hello','测试111','world'] WHERE key=:key if exists ";
//            String sqla = "UPDATE tp_msg_microblog SET ocont=:cont WHERE key=:key if exists ";
//            QueryOptions options = new QueryOptions();
//            options.setConsistencyLevel(ConsistencyLevel.LOCAL_ONE);
//            Cluster.Builder builder = Cluster.builder();
//            builder.withSocketOptions(new SocketOptions().setConnectTimeoutMillis(1500).setReadTimeoutMillis(2000))
//                    .withLoadBalancingPolicy(new TokenAwarePolicy(DCAwareRoundRobinPolicy.builder().withLocalDc("data-wb").build()))
//                    .withCredentials("cassandra", "cassandra").addContactPoint("10.136.133.115").withPort(9042).withQueryOptions(options);
//            Cluster cluster = builder.build();
//            Session session = cluster.connect("new_wb");
//            PreparedStatement update_statment = session.prepare(sqla);
//            BoundStatement bs = update_statment.bind();
//            List<String> tmplist = new ArrayList<String>() {
//                {
//                    add("world");
//                    add("hello");
//                }
//            };
//            bs.bind(tmplist, "tsina_4127577482482279");
//            future.add(session.executeAsync(bs));
//            for (int i = 0; i < future.size(); ++i) {
//                future.get(i).get();
//            }
//        } catch (Exception ex) {
//            LOG.error(ex.getMessage());
//        }
//    }
//
//}
